package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Mobile   string `gorm:"type:varchar(30)"`
	Password string `gorm:"type:varchar(32)"`
}

func (u *User) UserCreate(db *gorm.DB) error {
	return db.Debug().Create(u).Error
}

func (u *User) UserLogin(db *gorm.DB, mobile string, password string) error {
	return db.Debug().Where("mobile=? and password=?", mobile, password).Find(u).Error
}

func (u *User) UserFindById(db *gorm.DB, id int64) interface{} {
	return db.Debug().Where("id=?", id).Find(u).Error
}
